<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="../3-linkList/LinkedList.js"></script>
    <script>
        function Stack(){
            this.linkList = new LinkedList();
        }

        Stack.prototype = {
            push:function(item){
                this.linkList.append(item);
            },
            pop:function(){
                let index = this.linkList.length-1;
                return this.linkList.removeAt(index);
            },
            peek:function(){
                let index = this.linkList.length-1;
                return this.linkList.findbyIndex(index);
            },
            toString:function(){
                return this.linkList.toString();
            }
        }
        

        let arr1 = new Stack();
        arr1.push(1);
        arr1.push(456);
        console.log(arr1.peek())
        console.log(arr1.toString());

    </script>
</body>
</html>